import Vue from 'vue'
import VueRouter from 'vue-router'
import system from './routers/system'

Vue.use(VueRouter)
/**
 * 如果含有子路由, 父路由请勿添加name属性
 */
const routes = [
  {
    path: '/',
    component: () => import('@/views/Home'),
    children: [...system]
  },
  {
    path: '/visualization',
    name: 'visualization',
    component: () => import('@/views/page/visualization'),
    meta: {
      name: '可视化大屏'
    }
  },
  {
    path: '/login',
    name: 'log',
    component: () => import('@/views/login')
  },
  {
    path: '*',
    name: '404',
    component: () => import('@/views/404')
  }
]

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})

export default router // get token from cookie
